package contact.domain;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class DAOEnterprise extends HibernateDaoSupport{


	public DAOEnterprise(){
	}
	
	public static DAOEnterprise createInstance(){
		return new DAOEnterprise();
	}


	public Long create(Enterprise enterprise){
		return (Long) getHibernateTemplate().save(enterprise);
	}

	public Enterprise read(Long id){
		return (Enterprise) getHibernateTemplate().find("from Enterprise where id = ?", id).get(0);
	}

	public List<Contact> readAll(){
		return getHibernateTemplate().find("from Enterprise");
	}

	public void update(Enterprise enterprise){
		getHibernateTemplate().update(enterprise);
	}

	public void delete (Enterprise enterprise){
		getHibernateTemplate().delete(enterprise);
	}
}
